{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing_extensions import TypedDict\n",
    "from langgraph.graph import StateGraph,START,END\n",
    "\n",
    "# {\"foo\":1}\n",
    "\n",
    "\n",
    "class State(TypedDict):\n",
    "    foo: int\n",
    "\n",
    "# def agent_01(state,config) ->State\n",
    "\n",
    "def agent_01(state):\n",
    "    print(state[\"foo\"])\n",
    "    new_state = {\"foo\":state[\"foo\"]+1}\n",
    "    return new_state\n",
    "\n",
    "_buider = StateGraph(State)\n",
    "\n",
    "_buider.add_node(\"node_01\", agent_01)\n",
    "\n",
    "_buider.add_edge(START,\"node_01\")\n",
    "_buider.add_edge(\"node_01\",END)\n",
    "\n",
    "\n",
    "_graph = _buider.compile()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAA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GvrzsdJbZeXvqQ6HAVkoJVgpCgoY5q3nsKP8A3DX7Ar3VqnQ5WzqPZ3fNwZW9oS7IXtcQxAShi9xG2bWlLiAHt2AGd0DPeYWN3vsePm41G6d03q3Z5qBm5QtOi/MXSyW6HMaRNaZdhSIzak8Ss4UghZyUknI5j07NSo8NG6km01f3be7vYMs2X3y07L9nWntO6tvVo0/fIsYl6DNuTCVoytRB8PiD4xVn993Qvlrp37VY/wBdWhyMy6reW0havGpIJrx7BjfJ2v2BWcYThFQi1Zd3+Qcdi1LaNURnJFmusK7R218mt2DIQ8lKsA7pKSQDgg489STcBd3uFutrQKnJstlgBPOE74Kz6EBavoBr0lTEPcQAlsuKCUNoT3y1HmCUjiT5hWwbK9nj9qfF+u7XJT1NluNEVgmOhXOpX56gB+iMjpVWjF4qOEouc3/Lq73/ALtMo7zTKUpXmwFKUoDkulpg3uGuJcIbE6KvwmZDYcQfQeFVB7Ylo91RULfJYz8Vi4yW0+hKXAB6BV6pW+niK1HKnNrybRbtFB943SPyWf8Aa0v2tPeN0j8ln/a0v2tX6lb9exX1ZcWLsoPvG6R+Sz/taX7WnvG6R+Sz/taX7Wr9SmvYr6suLF2UH3jdI/JZ/wBrS/a1+jYdpAHjEnkeI3aX7Wr7SmvYr6suLF2QOntB6f0q4XbXamIz5G6ZBBW8R4i4olRHpqepSuSc5VHpTd33k2ilKVgD/9k=",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from IPython.display import display,Image\n",
    "\n",
    "display(Image(_graph.get_graph().draw_mermaid_png()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'foo': 1}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "_graph.invoke({\"foo\":0})"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "python310",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
